﻿using System;
using System.Collections.Generic;
using System.Reflection;
using System.Linq;

namespace ArmyManager.Modules
{
	public class ModuleLoader
	{
		public IEnumerable<IModule> GetModulesFromAssembly(Assembly assembly)
		{
			return assembly.GetTypes().Where(t => typeof(IModule).IsAssignableFrom(t) && !t.IsInterface && t.GetConstructor(new Type[0]) != null)
				.Select(Activator.CreateInstance).Cast<IModule>();
		}
	}
}